﻿using Admin_Web_test.Kit;
using Admin_Web_test.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Admin_Web_test
{
    public class PowerActionFilter: ActionFilterAttribute
    {//授期过滤器  这，我主要用于过滤未登录的用户。使用该过滤器要在方法或者控制器上方加 [PowerActionFilter]
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            if (context.HttpContext.Session.Get<Sysuser>(SessionKeysM.Login) == null)
            {
                context.Result = new RedirectResult("/home/login");
            }
        }
    }
}
